#ifndef _GRAPH_H_
#define _GRAPH_H_

#include <vector>
#include "AbstractGraph.h"
#include "MatrixGraph.h"
#include "ListGraph.h"

class Graph{
private:
	AbstractGraph* graphStructure_;
public:
	void readGraph(int vertexNum, int edgesNum, const std::vector<std::pair<int, int> >& edgesList){
		if (edgesNum > 1ll * (vertexNum)*(vertexNum) / 32 - vertexNum - 1){
			graphStructure_ = new MatrixGraph;
			graphStructure_->readGraph(vertexNum, edgesNum, edgesList);
		}
		else{
			graphStructure_ = new ListGraph;
			graphStructure_->readGraph(vertexNum, edgesNum, edgesList);
		}
	}
	std::vector<int> getAdjacentList(int inputVertex){
		return graphStructure_->getAdjacentList(inputVertex);
	}
	int getVertexNum(){
		return graphStructure_->getVertexNum();
	}
	int getEdgesNum(){
		return graphStructure_->getEdgesNum();
	}
	~Graph(){
		delete graphStructure_;
	}
};

#endif

